package com.example.controller;

import com.example.mall.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @ClassName OrderController
 * @Description TODO
 * @Author: XMK
 * @Date: 2020/4/3 11:04
 * @Version: 1.0
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/index")
    public List<Product> index() {

        String baseurl = "http://product-center";

        List<Product> products = restTemplate.getForObject("http://product-center/product/getList", List.class);

        return products;
    }

}
